package com.atguigu.gmall.product.controller;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.gmall.common.cache.Java0409GmallCache;
import com.atguigu.gmall.product.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * projectName: gmall
 *
 * @author: 陈鹏
 * time: 2022/9/28 12:42 星期三
 * description: 首页使用的控制层
 */
@RestController
@RequestMapping("/index/product")
public class IndexController {

    @Autowired
    private IndexService indexService;

    @GetMapping
    @Java0409GmallCache(prefix = "getIndexCategory:")
    public List<JSONObject> getIndexCategory(){
        return indexService.getIndexCategory();
    }
}
